﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
   public class dbHelper
    {
      public static  string conString = "server=.;database=Schools; uid=sa;pwd=123456;";
        public static DataTable GetDataTable(string  sql) {
           
          //  string sqlstring = "select *from Users";

            SqlConnection connection = new SqlConnection(conString);
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sql, connection);

            connection.Open();

            SqlDataAdapter adapter = new SqlDataAdapter();

            DataTable dt = new DataTable();
             adapter.Fill(dt);
          
            return dt;
        }
        public static Addorupate(string sql)
        {
            SqlConnection sqlConnection = new SqlConnection(conString);
            SqlCommand command = new SqlCommand(sql, sqlConnection);
                command.ExecuteNonQuery();
        }
    }
}
